def dz(n):
    if n < 10:
        return n
    else:
        return n % 10+dz(n//10)


def main():
    while True:
        try:
            n = int(input())
            print(dz(n))
        except:
            break


if __name__ == "__main__":
    main()
